import { useLocationStore } from "../store";
import Taro from "@tarojs/taro";
import { getCurrentPageUrlWithArgs } from "./tools";
import { onMounted } from "vue";

export const needLocation = {
  //mixin的方式
  onShow() {
    const locationStore = useLocationStore();
    const url = getCurrentPageUrlWithArgs(); //当前带参数的路径
    if (!locationStore.selectCityinfo) {
      Taro.redirectTo({
        url: `/pages/select-city/index?url=${encodeURIComponent(url)}`,
      });
    }
  },
};
